import url from '@/url.config'
import { request } from '../service'
export default ({ service, request, tools}) => ({
    // 获取项目部
    getDeptList(data) {
        return request({
            url: url.ip2+'/dept/findByPage',
            method: "post",
            data:data
        })
    },
    // 获取用户列表
    getUserList(data) {
        return request({
            url: url.ip2+'/user/findByPage',
            method: "post",
            data:data
        })
    },
    // 根据组织架构id分页查询用户列表
    postUserFindUserByAreaId(data){
        return request({
            url:url.ip2+"/user/findUserByAreaId",
            method:"post",
            data:data
        })
    },
    // 新增用户
    addUser(data) {
        return request({
            url: url.ip2+'/user/save',
            method: "post",
            data:data
        })
    },
    // 修改用户
    editUser(data) {
        return request({
            url: url.ip2+'/user/edit',
            method: "put",
            data:data
        })
    },
    // 删除用户
    delUser(id) {
        service.header={};
        return request({
            url: url.ip2+'/user/remove/'+id,
            method: "delete"
        })
    },
    // 根据用户id获取组织架构信息
    AreaFindAreasByUserId(id){
        return request({
            url:url.ip2+`/area/findAreasByUserId/${id}`,
            method:"get"
        })
    },
    //新增部门
    addDepartment(data){
        return request({
            url: url.ip2+'/dept/save',
            method: "post",
            data:data
        })
    },
    //查询部门
    getDepartmentList(data){
        return request({
            url: url.ip2+'/dept/findByPage',
            method: "post",
            data:data
        })
    },
    //删除部门
    delDepartment(id){
        return request({
            url: url.ip2+'/dept/remove/'+id,
            method: "delete"
        })
    },
    // 获取字典列表
    getDictionaryList(data) {
        return request({
            url: url.ip2+'/dictionary/findByPage',
            method: "post",
            data:data
        })
    },
    // 新增字典
    addDictionary(data) {
        return request({
            url: url.ip2+'/dictionary/save',
            method: "post",
            data:data
        })
    },
    // 修改字典
    editDictionary(data) {
        return request({
            url: url.ip2+'/dictionary/edit',
            method: "put",
            data:data
        })
    },
    // 删除字典
    delDictionary(id) {
        service.header={};
        return request({
            url: url.ip2+'/dictionary/remove/'+id,
            method: "delete"
        })
    },

    // 获取菜单列表
    getMenuList(data) {
        return request({
            url: url.ip2+'/menu/findByPage',
            method: "post",
            data:data
        })
    },
    // 新增菜单
    addMenu(data) {
        return request({
            url: url.ip2+'/menu/save',
            method: "post",
            data:data
        })
    },
    // 修改菜单
    editMenu(data) {
        return request({
            url: url.ip2+'/menu/edit',
            method: "put",
            data:data
        })
    },
    // 删除菜单
    delMenu(id) {
        service.header={};
        return request({
            url: url.ip2+'/menu/remove/'+id,
            method: "delete"
        })
    },

    // 根据项目组id获取运维点信息
    getTeamToPointList(id) {
        return request({
            url: url.ip2+'/point/findByTeamId/'+id,
            method: "get"
        })
    },
    // 获取运维点列表
    getPointList(data) {
        return request({
            url: url.ip2+'/point/findByPage',
            method: "post",
            data:data
        })
    },
    // 新增运维点
    addPoint(data) {
        return request({
            url: url.ip2+'/point/save',
            method: "post",
            data:data
        })
    },
    // 修改运维点
    editPoint(data) {
        return request({
            url: url.ip2+'/point/edit',
            method: "put",
            data:data
        })
    },
    // 删除运维点
    delPoint(id) {
        service.header={};
        return request({
            url: url.ip2+'/point/remove/'+id,
            method: "delete"
        })
    },
    // 获取区域列表
    getAreaList(data) {
        return request({
            url: url.ip2+'/area/findByPage',
            method: "post",
            data:data
        })
    },
    // 新增区域
    addArea(data) {
        return request({
            url: url.ip2+'/area/save',
            method: "post",
            data:data
        })
    },
    // 修改区域
    editArea(data) {
        return request({
            url: url.ip2+'/area/edit',
            method: "put",
            data:data
        })
    },
    // 删除区域
    delArea(id) {
        service.header={};
        return request({
            url: url.ip2+'/area/remove/'+id,
            method: "delete"
        })
    },
    // 根据区域id获取项目组信息
    getAreaToTeamList(id) {
        return request({
            url: url.ip2+'/team/findByAreaId/'+id,
            method: "get"
        })
    },
    // 获取项目组列表
    getTeamList(data) {
        return request({
            url: url.ip2+'/team/findByPage',
            method: "post",
            data:data
        })
    },
    // 新增项目组
    addTeam(data) {
        return request({
            url: url.ip2+'/team/save',
            method: "post",
            data:data
        })
    },
    // 修改项目组
    editTeam(data) {
        return request({
            url: url.ip2+'/team/edit',
            method: "put",
            data:data
        })
    },
    // 删除项目组
    delTeam(id) {
        service.header={};
        return request({
            url: url.ip2+'/team/remove/'+id,
            method: "delete"
        })
    },
    // 获取区域树形
    getAllAreasList() {
        return request({
            url: url.ip2+'/area/getAllAreas',
            method: "get"
        })
    },
    // 根据角色id分页查询用户列表
    getUserArea(data){
        return request({
            url: url.ip2+'/user/findUserByAreaId',
            method: "post",
            data:data
        })
    },
    getCompanyList(id){
        return request({
            url: url.ip2+'/company/findCompanyByPointId/'+id,
            method: "get"
        })
    },
    //
    setPointBindCompany(id,data){
        return request({
            url: url.ip2+'/area/pointBindCompany?pointId='+id,
            method: "post",
            data:data
        })
    },

    // 流程控制
    // 添加流程控制
    reviewSave(data){
        return request({
            url:url.ip2+"/review/save",
            method:"post",
            data:data
        })
    },
    // 获取流程控制分页
    reviewFindByPage(data){
        return request({
            url: url.ip2+"/review/findByPage",
            method:"post",
            data:data
        })
    },
    // 添加流程详细
    reviewDetailsSave(data){
        return request({
            url:url.ip2+"/review/details/save",
            method:"post",
            data:data
        })
    },
    // 修改流程控制
    reviewEdit(data){
        return request({
            url:url.ip2+"/review/edit",
            method:"post",
            data:data
        })
    },
    // 修改流程详情
    reviewEditDetail(data){
        return request({
            url:url.ip2+"/review/edit/detail",
            method:"put",
            data:data
        })
    },
    // 删除流程控制
    reviewRemove(id){
        return request({
            url: url.ip2+`/review/remove/${id}`,
            method:"delete"
        })
    },
    // 删除流程详细
    reviewRemoveDetails(id){
        return request({
            url: url.ip2 + `/review/remove/details/${id}`,
            method:"delete"
        })
    },
    // 添加流程关联人员
    ReviewSaveReviewUser(data){
        return request({
            url: url.ip2+"/review/save/review/user",
            method:"post",
            data:data
        })
    }
})
